package example.json.msg.controller;

import example.json.msg.impl.OnlineExample;
import example.json.msg.vo.Result;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * 1、签名不需要审核，直接审核内容。
 *
 */
@Controller
@EnableAutoConfiguration
@RequestMapping("/online")
public class OnlineSmsController implements BaseController {

    @Resource
    private OnlineExample onlineExample;

    @RequestMapping("/batchSend")
    @ResponseBody
    Result batchSend(@RequestParam(value = "acc", required = false) String acc,
                     @RequestParam(value = "phones", required = false) String phones,
                     @RequestParam(value = "content", required = false) String content) {
        return onlineErrorMsg("batchSend", onlineExample.batchSend(acc, phones, content));
    }

    @RequestMapping("/mutipleSend")
    @ResponseBody
    Result mutipleSend(@RequestParam(value = "acc", required = false) String acc,
                       @RequestParam(value = "content", required = false) String content) {
        return onlineErrorMsg("mutipleSend", onlineExample.mutipleSend(acc, content));
    }

    @RequestMapping("/voice")
    @ResponseBody
    Result voice(@RequestParam(name = "acc", required = false) String acc,
                 @RequestParam(name = "phones", required = false) String phones,
                 @RequestParam(name = "content", required = false) String content) {
        return onlineErrorMsg("voice：", "can not support");
    }

    @RequestMapping("/report")
    @ResponseBody
    Result report(@RequestParam(name = "acc", required = false) String acc) {
        return onlineErrorMsg("report", onlineExample.report(acc));
    }

    @RequestMapping("/sms")
    @ResponseBody
    Result sms(@RequestParam(name = "acc", required = false) String acc) {
        return onlineErrorMsg("sms", onlineExample.sms(acc));
    }

    @RequestMapping("/balance")
    @ResponseBody
    Result balance(@RequestParam(name = "acc", required = false) String acc) {
        return onlineErrorMsg("balance", onlineExample.balance(acc));
    }
}